import React from 'react';
import Account from '@web-design/account';
import { login } from '@/service';
import auth from '@/utils/auth';
import { message } from 'antd';
import { navigateTo } from '@/utils/navigate';

const App = ()=>{
const onSubmit =async (data:any)=>{
const res:any =  await login(data)

 auth.setToken(res.token)
 message.success('登录成功')
 navigateTo('/')
}
return (<Account onSubmit={onSubmit}  backgroundUrl={'https://wind-prod.oss-cn-hangzhou.aliyuncs.com/boss/static/resource/login-bg2.png'}>
    <Account.Panel>
        <Account.Title>服务商登录</Account.Title>
        <Account.Input name='account'/>
        <Account.Password name='password'/>
        <Account.Submit>登录</Account.Submit>
        <div style={{height:100}}/>
    </Account.Panel>
</Account>)
}
export default App